package com.conversationboard.view;

import java.io.UnsupportedEncodingException;
import java.util.List;

import com.conversationboard.model.UploadedFile;
import com.conversationboard.model.User;

public class RecentlyUploadedFilesDisplay {

	public static String display(User user) throws UnsupportedEncodingException {

		List<UploadedFile> files = user.getRecentlyUploadedFiles();
		StringBuilder buffer = new StringBuilder();

		if (files.size() > 0) {
			buffer.append("<p><strong>My Recently Uploaded Files:</strong></p>");
		}

		buffer.append("<p>");
		
		for (UploadedFile file : files) {
			buffer.append("<strong>" + file.getOriginalFileName() + "</strong>: " + file.getBBCode() + "<br />");
		}

		buffer.append("</p>");

		return buffer.toString();

	}

}
